package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	file, e := os.OpenFile("doc/test001.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
	if e != nil {
		fmt.Println("create file occurred error.", e)
		return
	}
	defer file.Close()

	writer := bufio.NewWriter(file)
	for i := 0; i < 10; i++ {
		writer.WriteString("hello world\n")
	}
	writer.Flush()
}
